<?php

declare(strict_types=1);
/**
 * This file is part of habo_new_media.
 *
 * @link     https://www.berlen.cn/
 * @contact  tech@berlen.cn
 * @license  http://gitlab.rehou.cn/habo/habo_new_media/-/blob/master/README.md
 */
namespace app\service\cdc\cost;

use app\model\ClientAccountModel;
use app\service\BaseService;
use app\service\client\AccountService;
use think\db\exception\DbException;

final class FilterService extends BaseService
{
    /**
     * 过滤账户是否符合投放条件.
     * @param ClientAccountModel $model
     * @param int $date
     * @return bool
     * @throws DbException
     */
    public static function accountFilter(ClientAccountModel $model, int $date = 0): bool
    {
        $accountId = $model->getKey();
        if (! $accountId) {
            return false;
        }
        // 判断是否正常账户
        return AccountService::isPuttingAccount($accountId, $date);
    }
}
